import React, { lazy } from 'react';
import { Navigate } from "react-router-dom";
import PrivateRoute from './PrivateRoute';

const Home = lazy(() => import('../view/Home'))
const Register = lazy(() => import('../view/Register'))
const Login = lazy(() => import('../view/Login'))
const NotFound = lazy(() => import('../view/NotFound'))


const routes = [
    {
        path: '/',
        element: <Navigate to='/Login' />,
    },
    {
        path: '/home',
        element: (
            <PrivateRoute>
                <Home />
            </PrivateRoute>
        ),
        exact: true,
    },
    {
        path: '/Login',
        element: <Login />,
        exact: true,
    },
    {
        path: '/Register',
        element: <Register />,
        exact: true,
    },
    {
        path: '*',
        element: <NotFound />,
    }
]

export default routes;